﻿using System;

namespace Borg
{
    [Serializable]
    public class PlugType : Qualifiable
    {
        private ExtensionType _extensionType;
        private MetaElementCollection<Param> _params;
        private SlotDefinition _slotDefinition;

        private bool _autoPlug;
        private string[] _autoTag;

        private string _onPlugging;
        private string _onPlugged;

        private string _onTagging;
        private string _onTagged;

        private string _onUnplugging;
        private string _onUnplugged;

        private string _onUntagging;
        private string _onUntagged;

        public ExtensionType ExtensionType
        {
            get { return _extensionType; }
            internal set { _extensionType = value; }
        }

        public MetaElementCollection<Param> Params
        {
            get { return _params; }
            internal set { _params = value; }
        }

        public SlotDefinition SlotDefinition
        {
            get { return _slotDefinition; }
            internal set { _slotDefinition = value; }
        }

        public bool AutoPlug
        {
            get { return _autoPlug; }
            set { _autoPlug = value; }
        }

        public string[] AutoTag
        {
            get { return _autoTag; }
            set { _autoTag = value; }
        }

        internal string OnPlugging
        {
            get { return _onPlugging; }
            set { _onPlugging = value; }
        }

        internal string OnPlugged
        {
            get { return _onPlugged; }
            set { _onPlugged = value; }
        }

        internal string OnTagging
        {
            get { return _onTagging; }
            set { _onTagging = value; }
        }

        internal string OnTagged
        {
            get { return _onTagged; }
            set { _onTagged = value; }
        }

        internal string OnUnplugging
        {
            get { return _onUnplugging; }
            set { _onUnplugging = value; }
        }

        internal string OnUnplugged
        {
            get { return _onUnplugged; }
            set { _onUnplugged = value; }
        }

        internal string OnUntagging
        {
            get { return _onUntagging; }
            set { _onUntagging = value; }
        }

        internal string OnUntagged
        {
            get { return _onUntagged; }
            set { _onUntagged = value; }
        }

        public override bool IsQualified
        {
            get { return Qualifier.IsQualified(this); }
        }

        internal PlugType(int id, string name)
            : base(id, name)
        { }

        public override bool Qualify()
        {
            return Qualifier.Qualify(this);
        }

        internal override AssemblyElement GetAssemblyElement()
        {
            return ExtensionType.Plugin;
        }
    }
}
